<!doctype html>
<meta charset=utf-8>
<title>Resizing the initial containing block dynamically with &lt;meta name="viewport">
       https://github.com/servo/servo/issues/8443</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
    var step2 = function() {
        var iframe = document.getElementsByTagName("iframe")[0];
        var body_style = iframe.contentWindow.getComputedStyle(iframe.contentDocument.body);
        if (body_style.width === "500px") {
          t.done();
        } else {
          window.requestAnimationFrame(step2);
        }
    };

    var step1 = function() {
        var iframe = document.getElementsByTagName("iframe")[0];
        var body_style = iframe.contentWindow.getComputedStyle(iframe.contentDocument.body);
        if (body_style.width === "400px") {
          iframe.width = 500;
          window.requestAnimationFrame(step2);
        } else {
          window.requestAnimationFrame(step1);
        }
    };

    window.run = step1;
}, "<body> inside <iframe> has the <iframe>’s width");
</script>
<iframe src="meta_viewport_resize_iframe.html" onload="run()" width=400></iframe>
